#include <iostream>
#include <string>
#include <functional>
#include <vector>
#include <ctime>

#include <unistd.h>
#include <pthread.h>
using namespace std;

int gcnt = 100;
void *ThreadRoutine(void *arg)
{
    const char *threadname = (const char *)arg;
    while (true)
    {
        std::cout << "I am a new thread: " << threadname << ", pid: " << getpid() << "gcnt: " << gcnt << " &gcnt: " << &gcnt << std::endl;
        gcnt--;
        sleep(1);
    }
}
int main()
{
     pthread_t tid;
    pthread_create(&tid, nullptr, ThreadRoutine, (void *)"thread 1");
   
    sleep(100);

    return 0;
}